﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Microsoft.Reporting.WebForms;
using Ewts.Code;

namespace Ewts.RDLC
{
    public partial class ins_fl : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int inStorID = 0;
                if (Request["insid"] != null && Request["insid"].ToString().Trim() != "")
                {
                    inStorID = int.Parse(Request["insid"].ToString().Trim());
                    //GetReportMultipleDataSourceFile
                }

                bindData(inStorID);
            }

        }
        protected void bindData(int inStorID)
        {
            List<ReportParameter> parameterList = new List<ReportParameter>();
            DataSet ds = new DataLib.BLL.ins_fuliao().GetList("instroageid = '" + inStorID + "'");
            

            //参数数据
            if (ds.Tables[0] != null && ds.Tables[0].Rows.Count>0)
            {

                parameterList.Add(new ReportParameter("paramTabno", ds.Tables[0].Rows[0]["tabno"].ToString()));
                parameterList.Add(new ReportParameter("Date", (DateTime.Parse(ds.Tables[0].Rows[0]["createtime"].ToString())).ToLongDateString().ToString()));
            }

            //为列表绑定数据
            ReportDataSource rds = new ReportDataSource("DataSet1", ds.Tables[0]);
            ReportViewer1.LocalReport.DataSources.Clear();
            ReportViewer1.LocalReport.DataSources.Add(rds);
            new RDLCPrinter().FillRow(ds.Tables[0], 3, 25, 25);//为列表添加空行
            ReportViewer1.LocalReport.SetParameters(parameterList);
            ReportViewer1.LocalReport.Refresh();

        }
    }
}